<?php 
require_once './model/db.php';
require_once './model/login.php';
$obj = new login();
$message = "";
        
        if(isset($_POST["Cancel"]))
        { 
            
            header("location:index.php");
        }
       
        if(isset($_POST["OK"]))
        {
            
            if($obj->lg() == true)
            {
                $username = $_POST["username"];
                if(!isset($_SESSION["login"]))
                {
                    $_SESSION["login"] = $username;
                }
                header("location: index.php");
            }
            else {
               
                $message = "tai khoan khong ton tai";
            }
           
        }
    ?>

<div id="content">
    
		<div class="post">
			<h1 class="title">Đăng Nhập</h1>
                        <form method="post" action="">
						<?php
							echo $message;
						?>
                            <table>
                                <tr>
                                    <td>Username</td>
                                    <td><input type="text" name="username" ></td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td>
                                        <input type="submit" name="OK" value="OK">
                                        <input type="submit" name="Cancel" value="Cancel">
                                    </td>
                                </tr>
                            </table>
                        </form>
			
		</div>
    
</div>